home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cpp_libs / varia / silo.lha / silo / SimEntityList.h < prev    next >
C/C++ Source or Header  |  1993-08-08  |  1KB  |  52 lines

  1. /* $Author: ecsv38 $ $Date: 90/08/21 14:46:36 $ $Revision: 1.1 $ */
  2. /* (c) S. Manoharan  sam@lfcs.edinburgh.ac.uk */
  3.  
  4. #ifndef SimEntityList_H
  5. #define SimEntityList_H
  6.  
  7. #include "Entity.h"
  8.  
  9. class SimEntityList;
  10.  
  11. class SimEntityItem {
  12.    friend class SimEntityList;
  13. private:
  14.    SimEntityItem *next;
  15.    SimEntityItem *prev;
  16.    Entity * entity;
  17.  
  18.    SimEntityItem(Entity *const v = 0)
  19.         { entity = v; next = prev = 0; }
  20. };
  21.  
  22. class SimEntityList {
  23. private:
  24.    SimEntityItem *head;
  25.    SimEntityItem *tail;
  26.    char *listname;
  27. public:
  28.    SimEntityList(char *const s = 0)
  29.         { head = tail = 0; listname = s; }
  30.    SimEntityList(Entity *const entity, char *const s)
  31.         { head = new SimEntityItem(entity); listname = s; }
  32.    virtual ~SimEntityList();
  33.  
  34.    void name(char *const s)    { listname = s; }
  35.    char *name() const        { return listname; }
  36.    short is_empty()        { return head == 0; }
  37.    void print();
  38.  
  39.    int min_entity_id();
  40.    int max_entity_id();
  41.  
  42.    Entity *get()        { return remove(max_entity_id()); }
  43.    Entity *remove(const int eid);
  44.  
  45.    void insert(Entity *const);
  46.    void append(Entity *const);
  47. };
  48.  
  49.  
  50.  
  51. #endif SimEntityList_H
  52.